package cn.codesea.housework_user.ui.worker;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.codesea.housework_user.R;
import cn.codesea.housework_user.adapter.listener.OnRecyclerItemClickListener;
import cn.codesea.housework_user.adapter.WorkerOrderRcvAdapter;
import cn.codesea.housework_user.adapter.listener.OnRecyclerItemClickOrderListener;
import cn.codesea.housework_user.entity.Order;

/**
 * 人员推荐页
 */
public class OrderListWorkerActivity extends AppCompatActivity {

    @BindView(R.id.toolbar)
    Toolbar toolbar;

    @BindView(R.id.recyclerView)
    RecyclerView mRecyclerView;
    WorkerOrderRcvAdapter adapter;
    List<Order> orders = new ArrayList<>();
    private LinearLayoutManager mLinearLayoutManager;

    @BindView(R.id.search_iv)
    ImageView search_iv;
    @BindView(R.id.search_et)
    EditText search_et;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_orderlist_worker);
        ButterKnife.bind(this);
        init();
    }

    private void init(){
        initData();
        initView();
    }

    private void initData() {

    }

    private void initView(){

        // 初始化 toolbar
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        adapter = new WorkerOrderRcvAdapter(this,orders);
        adapter.setRecyclerItemClickListener(new OnRecyclerItemClickOrderListener() {
            @Override
            public void onItemClick(int Position, List<Order> list) {

            }
        });
        mLinearLayoutManager = new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false);
        mRecyclerView.setLayoutManager(mLinearLayoutManager);
        mRecyclerView.setAdapter(adapter);

        search_iv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(OrderListWorkerActivity.this,search_et.getText(), Toast.LENGTH_SHORT).show();
            }
        });

    }
}
